﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using ModuleDALCore;
using DTO;

namespace DAL
{
	public class SMS_MauDAO:DALBase
	{
		public SMS_MauDAO()
        {
            this.OpenConnect();
        }
        private DataTable dt;
        private string _SpName;

        public string SpName
        {
            get { return "SPSMS_Mau"; }
            set { _SpName = value; }
        }
        public DataTable GetListSMS()
        {
            dt = new DataTable();
			try
			{

				dt = DBManager.Intance.ExecuteDataTable(SpName, ConvertClassToArray.GetParamName(new SMS_Mau(), null), ConvertClassToArray.GetValues(new SMS_Mau(), 0));
				return dt;
			}
			catch { return null; }
        }
		public List<SMS_Mau> GetListSMSS()
		{
			dt = new DataTable();
			List<SMS_Mau> SMS = new List<SMS_Mau>();
			try
			{

				dt = DBManager.Intance.ExecuteDataTable(SpName, ConvertClassToArray.GetParamName(new SMS_Mau(), null), ConvertClassToArray.GetValues(new SMS_Mau(), 0));
				SMS = (List<SMS_Mau>)ConvertDatatableToList.ConvertTo<SMS_Mau>(dt);
				return SMS;
			}
			catch { return null; }
		}
    
        public bool INSERT(SMS_Mau SMS)
        {

            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(SMS, null), ConvertClassToArray.GetValues(SMS, 1)) == 1);

            }
			catch { return false; }
        }
        public bool UPDATE(SMS_Mau SMS)
        {

            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(SMS, null), ConvertClassToArray.GetValues(SMS, 2)) == 1);

            }
			catch { return false;}
        }
        public bool DELETE(SMS_Mau SMS)
        {

            try
            {
                return (DBManager.Intance.ExecuteNonQuery(SpName, ConvertClassToArray.GetParamName(SMS, null), ConvertClassToArray.GetValues(SMS, 3)) ==1);

            }
			catch { return false;}
        }
	}
}
